package com.zfxt.web;

import com.zfxt.biz.autoconfig.GenericRest;
import com.zfxt.common.RestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/9/11.
 */
@RestController
@RequestMapping("/client")
public class HttpClientController {
    @Autowired
    private GenericRest genericRest;
    @RequestMapping("/test1")
    public String getHello(){
        String url="http://localhost:8081/client/test2";                                //restRestponse是自定义的返回类
        RestResponse<String> result=genericRest.get(url, new ParameterizedTypeReference<RestResponse<String>>(){}).getBody();
        return result.getResult();
    }
    @RequestMapping("/test2")
    public RestResponse gethello1(){
        return RestResponse.success("你好");
    }
}
